Most of the pages have a configuration or scripts that needs some tweaking before being ready for production. There’s several way to achieve this.
If it’s a docker-compose template, you can simply create a dedicated .env file, which will be called when you run docker compose up, see the docker documentation on variable interpolation.
You can also update manually the configuration template by replacing the variables (example: ${MY_VARIABLE}) by their value. This is long, tedious and error-prone, especially when using really long config files (looking at you Authelia), but nonetheless feasible.
Finally, you can prepare a .env file and do the variable interpolation using the command line. The file should look like this:
# config file for service XYZ
VAR1='FOO'
VAR2='BAR'
VAR3='BAZ'
Once the .env file is created, export the variables from it to your shell:
eval $(egrep "^[^#;]" .env | xargs -d'\n' -n1 | sed 's/^/export /')
Note 1 : If your variable has a space and/or special characters (such as \(\\#@), enclose it with single quotes, example: VAR=’\#My \)variable’
Note 2 : You can of course name your environment file another name than .env, don’t forget to update the command accordingly.
Note 3 : To check if a variable has been exported correctly, you can run export -p | grep YOUR_VARIABLE_NAME.
Note 4 : This command is long and complicated. More information on how it came to be. And more here. Yes, this is a recurring topic.
Creating the config file from your template config.tpl is much easier:
envsubst < config.tpl > config
Note 1 : Just to make everything crystal clear, config.tpl is the input, and config the output.
All set ! You now have a prim and proper configuration file with all the correct values in place. Don’t upload it to your Github !